import { createStore } from 'vuex'
// 引入模块
import user from './modules/user.js'
import category from './modules/category.js'
import cart from './modules/cart.js'
// 引入vuex持久化插件
import createPersistedstate from 'vuex-persistedstate'
// 创建仓库
export default createStore({
  state: {
  },
  mutations: {
  },
  actions: {
  },
  getters: {

  },
  modules: {
    user,
    category,
    cart
  },
  // 配置插件
  plugins:[
    // 默认存储在localStorage中
    createPersistedstate({
      // 本地存储的名字
      key:'erabbit-store',
      // 指定需要存储的模块
      paths:['user','cart']
    })
  ]
})
